<template>
  <van-swipe :autoplay="3000" lazy-render>
    <van-swipe-item v-for="(item,index) in banners" :key="index">
      <a :href="item.link">
        <img style="width:100%" :src="item.image" @load="imgLoad" />
      </a>
    </van-swipe-item>
  </van-swipe>
</template>

<script>
export default {
  name: "HomeSwiper",
  props: {
    banners: {
      type: Array,
      default() {
        return [];
      }
    }
  },

  methods: {
    imgLoad() {
      if (!this.isLoad) {
        this.$emit("swiperImageLoad");
        this.isLoad = true;
      }
    }
  },
  data() {
    return {
      isLoad: false
    };
  },
  components: {}
};
</script>

<style scoped></style>
